<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/jQuery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        li {
            list-style: none;
        }
        .box {
            position: relative;
            width: 800px;
            height: 300px;
            margin: 100px auto;
            border: 1px solid #333;
        }
        textarea {
            width: 600px;
            height: 200px;
            margin-top: 30px;
        }
        ul li {
            position: relative;
            width: 600px;
            display: none;
            margin-left: 65px;
        }
        ul li a {
            position: absolute;
            right: 0;
        }
    </style>
    <script>
        $(function(){
            $('.btn').on('click',function(){
                var li = $('<li></li>');
                li.html($('.txt').val() + "<a href='javascript:;'>删除</a>");
                $('ul').prepend(li);
                li.slideDown();
                $('.txt').val('')
            })
            //点击删除按钮，删除评论
            $('ul').on('click','a',function(){
                $(this).parent().slideUp(function(){
                    $(this).remove();
                });
            })
        })
    </script>
</head>
<body>
    <div class="box" id="weibo">
        <span>微博发布</span>
        <textarea name="" id="" cols="30" rows="10" class="txt"></textarea>
        <button class="btn">发布</button>
        <ul>
            
        </ul>
    </div>
</body>
</html>